package com.atguigu.domain;

import lombok.Data;

@Data
public class R {

    private String code;
    private String message;
    private Object data;

    public static R ok(Object data) {
    	R r = new R();
    	r.setCode("200");
    	r.setMessage("操作成功");
    	r.setData(data);
    	return r;
    }

    public static R ok(String message, Object data) {
    	R r = new R();
    	r.setCode("200");
    	r.setMessage(message);
    	r.setData(data);
    	return r;
    }

    public static R ok(String message) {
    	R r = new R();
    	r.setCode("200");
    	r.setMessage(message);
    	return r;
    }


    public static R ok() {
    	R r = new R();
    	r.setCode("200");
    	r.setMessage("操作成功");
    	return r;
    }



    public static R error(String code, String message) {
    	R r = new R();
    	r.setCode(code);
    	r.setMessage(message);
    	return r;
    }

    public static R error(String message) {
    	R r = new R();
    	r.setCode("500");
    	r.setMessage(message);
    	return r;
    }

    public static R error() {
    	R r = new R();
    	r.setCode("500");
    	r.setMessage("操作失败");
    	return r;
    }

    public static R error(String code, String message, Object data) {
    	R r = new R();
    	r.setCode(code);
    	r.setMessage(message);
    	r.setData(data);
    	return r;
    }

    public static R error(String message, Object data) {
    	R r = new R();
    	r.setCode("500");
    	r.setMessage(message);
    	r.setData(data);
    	return r;
    }

}
